/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2020 All Rights Reserved.
 */
package com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern;

import com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.handler.DeptManagerLeaveHandler;
import com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.handler.DirectLeaderLeaveHandler;
import com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.handler.GManagerLeaveHandler;

/**
 * 测试类
 *
 * @author zhaorongzhang
 * @version ResponsibilityTest.java, v 0.1 2020/1/18 4:05 下午 zhaorongzhang Exp $$
 */
public class ResponsibilityTest {

    public static void main(String[] args) {
        LeaveRequest leaveRequest = LeaveRequest.builder().leaveDays(31).name("3天请假者").build();

        AbstractLeaveHandler directLeaderLeaveHandler = new DirectLeaderLeaveHandler("直接上级");
        AbstractLeaveHandler deptManagerLeaveHandler = new DeptManagerLeaveHandler("部门经理");
        AbstractLeaveHandler gManagerLeaveHandler = new GManagerLeaveHandler("总经理");

        directLeaderLeaveHandler.setNextHandler(deptManagerLeaveHandler);
        deptManagerLeaveHandler.setNextHandler(gManagerLeaveHandler);

        directLeaderLeaveHandler.handlerRequest(leaveRequest);

    }

}